var checkMobile = (rule,value,cb) => {//验证手机号的正则表达式
    const regMobile =/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/
    if (regMobile.test(value)) {
    //正则验证手机号是否合法
    return cb()
    }
    cb(new Error('请输入合法的手机号'))
}

var checkIdCard = (rule,value,cb) => {//验证身份证号的正则表达式
    const IdCard = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
    if (IdCard.test(value)) {
    return cb()
    }
    cb(new Error('请输入合法的身份证号'))
}
//  注册（学生用户）
export const stuRegisterRules = {
    name: [
        { required: true, message: "请输入姓名", trigger: 'blur' }
    ],
    gender: [
        { required: true, message: "请选择性别", trigger: 'change' }
    ],
    work_unit: [
        { required: true, message: "请输入工作单位", trigger: 'blur' }
    ],
    education: [
        { required: true, message: "请选择学历", trigger: 'change' }
    ],
    school: [
        { required: true, message: "请输入毕业院校", trigger: 'blur' }
    ],
    Major: [
        { required: true, message: "请输入专业", trigger: 'blur' }
    ],
    first_time: [
        { required: true, message: "请选择收获证时间", trigger: 'blur' }
    ],
    hire_date: [
        { required: true, message: "请选择入职时间", trigger: 'blur' }
    ],
    id_card: [
        { required: true, message: "请输入身份证", trigger: 'blur' },
        { validator:checkIdCard,trigger:'blur'}
    ],
    Phone: [
        { required: true, message: "请输入手机号", trigger: 'blur' },
        { validator:checkMobile,trigger:'blur'}
    ],
    password: [
        { required: true, message: "请输入密码", trigger: 'blur' }
    ],
    repassword: [
        { required: true, message: "请再次输入密码", trigger: 'blur' }
    ],
}
//  重置
export const resetRules = {
    id:[
        { required:true, message:'请输入身份证号',trigger:'blur'},
          { validator:checkIdCard,trigger:'blur'}
    ],
    password1: [
        { required: true, message: "请输入密码", trigger: 'blur' },
        { min:6,max:20,message:'输入位数最小6位', trigger:'blur'},
    ],
    password2: [
        { required: true, message: "请再次确认密码", trigger: 'blur' }
    ],

}
// 登录
export const loginRules = {
    id_card:[
        { required:true, message:'请输入身份证号',trigger:'blur'},
          { validator:checkIdCard,trigger:'blur'}
    ],
    pwd: [
        { required: true, message: "请输入密码", trigger: 'blur' },
        { min:6,max:20,message:'输入位数最小6位', trigger:'blur'},
    ],
    

}
// var checkEmail = (rule, value, cb) => {//验证邮箱的正则表达式
//     const regEmail = /^([a-zA-Z0-9_-])+a([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/
//     if (regEmail.test(value)) {        //正则验证邮箱是否合法
//         //合法的邮箱
//         return cb()
//     } else {
//         cb(new Error('请输入合法的邮箱'))//返回错误信息必须写
//     }
// }

//验证手机号的规则
